package yaner.hotel.manager.resource.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yaner.hotel.manager.common.dto.dict.DictAddDto;
import yaner.hotel.manager.common.dto.dict.DictDto;
import yaner.hotel.manager.common.dto.dict.DictUpdateDto;
import yaner.hotel.manager.common.dto.room.RoomAddDto;
import yaner.hotel.manager.common.dto.room.RoomDto;
import yaner.hotel.manager.common.dto.room.RoomUpdateDto;
import yaner.hotel.manager.common.vo.DictVo;
import yaner.hotel.manager.common.vo.ResponseVo;
import yaner.hotel.manager.common.vo.RoomVo;
import yaner.hotel.manager.resource.service.IDictService;

import java.util.List;

/**
 * @Author kf-leig
 * @Description: 字典管理
 * @Version 1.0
 * @Date 2024年05月22日11:31:00
 */
@RestController
public class DictController {
    @Autowired
    private IDictService dictService;
    @PostMapping("/dict-list")
    public ResponseVo<List<DictVo>> dictList(@RequestBody DictDto dictDto){
        List<DictVo> dictVos = dictService.dictList(dictDto);
        return ResponseVo.success(dictVos);
    }

    @GetMapping("get-dict-info")
    public ResponseVo<DictVo> getDictInfo(@RequestParam("dictId") String dictId){
        DictVo dictInfo = dictService.getDictInfo(dictId);
        return ResponseVo.success(dictInfo);
    }

    @PostMapping("add-dict-info")
    public ResponseVo<String> addDictInfo(@RequestBody DictAddDto dictAddDto){
        String s = dictService.addDictInfo(dictAddDto);
        return ResponseVo.success(s);
    }

    @PostMapping("update-dict-info")
    public ResponseVo<String> updateDictInfo(@RequestBody DictUpdateDto dictUpdateDto){
        String s = dictService.updateDictInfo(dictUpdateDto);
        return ResponseVo.success(s);
    }

    @DeleteMapping("delete-dict-info")
    public ResponseVo<String> deleteDictInfo(@RequestParam("dictId") String dictId){
        String s = dictService.deleteDictInfo(dictId);
        return ResponseVo.success(s);
    }
}
